package orthoplanner.com.google.code.main;

import java.awt.Container;
import java.awt.Dimension;
import java.awt.GraphicsEnvironment;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Point;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.UIManager;

import orthoplanner.com.google.code.ui.ControlPanel;
import orthoplanner.com.google.code.ui.ImageHolderPanel;
import orthoplanner.com.google.code.ui.ImageViewer;


public class Main {
	public static void main(String[] args) {
		
		try {
			UIManager.setLookAndFeel("com.jtattoo.plaf.acryl.AcrylLookAndFeel");
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		
			
		JFrame frame = new JFrame();
		
		ImageViewer imgViewer = new ImageViewer(700, 700);
		JPanel left = new ControlPanel(imgViewer);
		ImageHolderPanel right = new ImageHolderPanel(imgViewer);

		Container window = frame.getContentPane();
		window.setLayout(new GridBagLayout());
		left.setPreferredSize(new Dimension(200, 700));
		left.setMinimumSize(new Dimension(200, 700));
		GridBagConstraints gbc = new GridBagConstraints();
		gbc.gridx = 0;
		gbc.gridy = 0;
		gbc.weightx = 0; 
		gbc.weighty = 1.0;
		gbc.anchor = GridBagConstraints.FIRST_LINE_START;

		window.add(left, gbc);
		gbc.fill = GridBagConstraints.BOTH;
		gbc.gridx = 1;
		gbc.weightx =  1.0;
		gbc.weighty = 1.0;
		right.setPreferredSize(new Dimension(400, 700));
		right.setMinimumSize(new Dimension(400, 700));
		// right.setBorder(BorderFactory.createLineBorder(Color.red));
		window.add(right, gbc);
		window.setPreferredSize(new Dimension(1000, 700));
	
		//frame.add(new TestPanel(new Line(new Point(0,0),new Point(0,0))));
	    frame.setMinimumSize(new Dimension(1000, 700));
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		imgViewer.init();
		frame.pack();

	    frame.setVisible(true);
	    
	    
		Point cp=GraphicsEnvironment.getLocalGraphicsEnvironment().getCenterPoint();
		frame.setLocation(cp.x-(frame.getWidth()/2),cp.y-(frame.getHeight()/2));

	}
}
